class CreateRoleWarehouses < ActiveRecord::Migration
  def self.up
    create_table :role_warehouses do |t|
      t.integer :company_id         ,:null => false             #所属公司的ID
      t.integer :employee_id        ,:null => false             #操作此进库的员工ID
      t.integer :role_id            ,:null => false             #角色的ID
      t.integer :warehouse_id       ,:null => false             #仓库的ID
      t.integer :is_locked     ,:limit => 1 ,:default => 0 #锁定 1为True 0为False
      t.integer :lock_version  ,:default => 0   #乐观锁
      t.timestamps
    end
  end

  def self.down
    drop_table :role_warehouses
  end
end
